<script>
import update from '@/common/utils/update.js';
export default {
	onLaunch: function () {
		if (process.env.NODE_ENV === 'development') {
			// 判断是否为开发环境，开发环境不提示更新
		} else {
			update()
		}
		const is_house = uni.getStorageSync('is_house');
		const is_service = uni.getStorageSync('is_service');
		function getTabbar(is_house, is_service) {
			if (is_service === 1 && is_house === 1) {
				uni.setTabBarItem({
					// 修改底部导航
					index: 0,
					visible: true
				});
				uni.setTabBarItem({
					// 修改底部导航
					index: 1,
					visible: true
				});
				uni.setTabBarItem({
					// 修改底部导航
					index: 2,
					visible: true
				});
				uni.setTabBarItem({
					// 修改底部导航
					index: 3,
					visible: true
				});
			}

			if (is_service === 1 && is_house === 0) {
				uni.setTabBarItem({
					// 修改底部导航
					index: 3,
					visible: true
				});
				uni.setTabBarItem({
					// 修改底部导航
					index: 2,
					visible: true
				});
				uni.setTabBarItem({
					// 修改底部导航
					index: 0,
					visible: false
				});
				uni.setTabBarItem({
					// 修改底部导航
					index: 1,
					visible: false
				});
			}

			if (is_service === 0 && is_house === 1) {
				uni.setTabBarItem({
					// 修改底部导航
					index: 3,
					visible: false
				});
				uni.setTabBarItem({
					// 修改底部导航
					index: 2,
					visible: true
				});
				uni.setTabBarItem({
					// 修改底部导航
					index: 0,
					visible: true
				});
				uni.setTabBarItem({
					// 修改底部导航
					index: 1,
					visible: true
				});
			}
		}
		getTabbar(is_house, is_service);
		this.$store.dispatch('websocketInit')
		
		if (uni.getLocale() != 'zh-Hans') {
			uni.setLocale('zh-Hans')
		}
	},
	onShow: function () {
	
		console.log('App Show');
	},
	onHide: function () {
		console.log('App Hide');
		// this.$store.dispatch('websocketClose')
	}
};
</script>

<style lang="scss">
/*每个页面公共css */
@import './static/css/public.scss';
@import 'uview-ui/index.scss';
</style>
